<html>
<head>
<script src="../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
</head>
<body>
<script>
description("Verify that the custom properties on a WebGL rendering context object are retained across GCs.");

window.jsTestIsAsync = true;

if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

function runTest() {
    canvas = document.createElement("canvas");
    context = create3DContext(canvas);
    context.customProperty = "value";
    extensions = [ "EXT_blend_minmax" ];
    extensionObject = null;

    shouldBeEqualToString("context.customProperty", "value");
    extensions.forEach(function(extension) {
        extensionObject = context.getExtension(extension);
        extensionObject.customProperty = "value";
        shouldBeEqualToString("extensionObject.customProperty", "value");
    });
    context = null;
    extensionObject = null;
    gc();
    context = create3DContext(canvas);
    shouldBeEqualToString("context.customProperty", "value");
    extensions.forEach(function(extension) {
        extensionObject = context.getExtension(extension);
        shouldBeEqualToString("extensionObject.customProperty", "value");
    });
    finishJSTest();
}

window.onload = runTest;
</script>
</body>
</html>
